import request from '@/router/axios'; // 考核模板

// 列表
export const getList = (current, size, params) => {
  return request({
    url: '/api/hg-quality/supplierchecktemplate/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  })
}

// 删除
export const remove = (ids) => {
  return request({
    url: '/api/hg-quality/supplierchecktemplate/remove',
    method: 'post',
    params: {
      ids
    }
  })
}
// 新增-编辑
export const submit = (data, type) => {
  return request({
    url: `/api/hg-quality/supplierchecktemplate/${type}`,
    method: "post",
    data: data
  });
};

// 详情
export const detail = id => {
  return request({
    url: `/api/hg-quality/supplierchecktemplate/detail`,
    method: "get",
    params: {
      id
    }
  });
};

// 获取模板数据
export const getTemplate = (checkType) => {
  return request({
    url: '/api/hg-quality/supplierchecktemplate/list',
    method: 'get',
    params: {
      checkType
    }
  })
}

// 根据考核分类获取考核指标
export const getCheckTarget = (checkType) => {
  return request({
    url: '/api/hg-quality/supplierchecktarget/getList',
    method: 'get',
    params: {
      checkType
    }
  })
}

// 根据指标id获取内容
export const getCcheckContent = (id) => {
  return request({
    url: '/api/hg-quality/supplierchecktargetsub/list',
    method: 'get',
    params: {
      id
    }
  })
}
// 根据指标或者内容获取供应商考核标准
export const getCheckStandard = (params) => {
  return request({
    url: '/api/hg-quality/suppliercheckstandard/list',
    method: 'get',
    params,
  })
}

// 启用状态更改
export const changeEnableStatus = (data) => {
  return request({
    url: `/api/hg-quality/supplierchecktemplate/submit`,
    method: "post",
    data: data
  });
};